package org.benetech.beans;


/**
 * A filter which discriminates objects.
 * @author Reuben Firmin
 *
 * @param <T> The type of objects that can be filtered
 * @param <U> The type of callback objects
 */
public interface Filter<T, U> {

	/**
	 * True if the given item, or group of items, can be accepted.
	 * @param item Never null
	 * @return True if accepted
	 */
	boolean accept(T... item);

	/**
	 * Filter method with a callback object. Implementations may chose just to delegate to accept if callbacks do not
	 * make sense.
	 * @param callback The callback object. May be null, ignore if so.
	 * @param item Items to filter
	 * {@link accept(T... item)}
	 * @return True if accepted
	 */
	boolean acceptWithCallback(FilterCallback<U> callback, T... item);
}
